package com.wlc.oop.demo08.interface1;

import com.wlc.oop.demo08.Item;
import com.wlc.oop.demo08.LifePotion;

/**
 * @author 王立朝 wanglichao@champion-credit.com
 * @description 英雄
 * @date 2021-07-03 10:08
 */
public class Hero {
    String name;

    /**
     * 英雄只需要传入相应的不同
     * 属性的类即可
     *
     * @param item
     */
    public void userItem(Item item, String name) {
        item.effect(name);
    }

    public void kill(Mortal mortal) {
        System.out.println(this.name + " 放了一个大招");
        mortal.die();
    }

    public static void main(String[] args) {
        Hero hero = new Hero();
        hero.name = "盖伦";
        AdApHero adApHero = new AdApHero();
        adApHero.name = "索威压";
        hero.kill(adApHero);
        hero.userItem(new LifePotion(),hero.name+" 用了一滴生命药水,");
        APHero apHero = new APHero();
        apHero.name = "小猪佩奇";
        hero.kill(apHero);
        AdHero adHero = new AdHero();
        adHero.name = "索威压";
        hero.kill(adHero);
    }
}
